package com.net.xpay.core.enums;

import com.net.common.enums.base.StringEnum;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;

/**
 * 转账单据状态。可能出现的状态如下：
 * SUCCESS：转账成功；
 * WAIT_PAY：等待支付；
 * CLOSED：订单超时关闭
 */
@Slf4j
@Getter
@AllArgsConstructor
public enum BookAccountChargeOrderStatus implements StringEnum<BookAccountChargeOrderStatus> {

    WAIT_PAY("WAIT_PAY", "等待支付"),
    SUCCESS("SUCCESS", "转账成功"),
    CLOSED("CLOSED", "订单超时关闭"),
    UNKNOWN("UNKNOWN", "未知")
    ;

    public static BookAccountChargeOrderStatus of(String status) {
        try {
            return BookAccountChargeOrderStatus.valueOf(status);
        } catch (Exception e) {
            log.error("of error|status={}", status);
            return UNKNOWN;
        }
    }

    private String value;

    private String desc;
}
